package testcasegenerator.clp.methodlevel;

import java.util.List;

import com.parctechnologies.eclipse.Atom;
import com.parctechnologies.eclipse.CompoundTerm;

public class TestCase {
	private String pathNo;
	// private List<String> oState;
	private String oState;
	private String arg;
	private String result;
	// private List<String> nState;
	private String nState;

	public TestCase(CompoundTerm ct) {
		System.out.println(ct);
		// Path
		pathNo = ct.arg(1).toString();

		// OState
		oState = ct.arg(2).toString().replace("[", "").replace("]", "");


		// Arg
		arg = ct.arg(3).toString().replace("[", "").replace("]", "");


		// Result
		if (ct.arg(4) != null) {
			if(ct.arg(4) instanceof Atom){
				Atom a = (Atom)ct.arg(4);
				result = a.functor().toString();
			}else{
				result = ct.arg(4).toString().replace("[", "").replace("]", "");

			}
			
		}
		

		// NState
		nState = ct.arg(5).toString().replace("[", "").replace("]", "");

		// CompoundTerm os = (CompoundTerm)ct.arg(2);
		// for(int i=0; i<os.arity(); i++){
		// oState.add((String)os.arg(i));
		// }

	}

	public String toString() {
		String str = "\n\tTestCase: " + "\n\t\tpathNo: " + pathNo + "\n\t\toState: " + oState + "\n\t\targ: " + arg + "\n\t\tresult: " + result + "\n\t\tnState: " + nState;
		return str;
	}

	public String getPathNo() {
		return pathNo;
	}

	public void setPathNo(String pathno) {
		this.pathNo = pathno;
	}

	public String getOstate() {
		return oState;
	}

	public void setOstate(String ostate) {
		this.oState = ostate;
	}

	public String getArg() {
		return arg;
	}

	public void setArg(String arg) {
		this.arg = arg;
	}

	public String getResult() {
		return result;
	}

	public void setResult(String result) {
		this.result = result;
	}

	public String getNstate() {
		return nState;
	}

	public void setNstate(String nstate) {
		this.nState = nstate;
	}

}
